﻿#include "HnrjitLabel.h"
#include "HnrjitContainer.h"

CHnrjitLabel::CHnrjitLabel()
	: CHnrjitControl()
{
}

void CHnrjitLabel::SetTextAlign(UINT nTextAlign)
{
	nTextAlign |= DT_EDITCONTROL;
	CHnrjitControl::SetTextAlign(nTextAlign);
}

void CHnrjitLabel::DrawControl(HDC hdc)
{
	CRect rcReference = CRect(GetLocation() + m_pContainer->GetLocation(), GetSize());

	ControlStatus iControlStatus = GetControlState();
	if (m_spBackIcons[iControlStatus])
	{
		DrawImage(hdc, rcReference, iControlStatus);
	}
	else
	{
		if (iControlStatus == kActivated && m_spBackIcons[kNormal])
		{
			// 处于激活状态但无激活时图片
			DrawImage(hdc, rcReference, kNormal);
		}
		else
		{
			DrawRect(hdc, rcReference, iControlStatus);
		}
	}
	DrawTitle(hdc, rcReference, iControlStatus);
}
